#include "mem.h"
#include "malloc.h"
#include <cstdlib>
#include <unistd.h>

void* mem_malloc_aligned (size_t size, size_t alignment)
{
    return memalign (alignment, size);
}

void mem_free_aligned (void* ptr)
{
    free (ptr);
}

size_t get_total_system_memory()
{
    long pages = sysconf(_SC_PHYS_PAGES);
    long page_size = sysconf(_SC_PAGE_SIZE);
    return pages * page_size;
}
